package com.test.java;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.sun.xml.internal.ws.util.StringUtils;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class test {
    public static void main(String[] args) {
//        String ss="";
//        System.out.println(ss.substring(0,1));
        LocalDateTime now = LocalDateTime.now();
        final LocalDateTime localDateTime = now.plusDays(1);
        System.out.println(now);
        System.out.println(localDateTime);
        System.out.println(localDateTime.isBefore(LocalDateTime.now()));
        BigDecimal bigDecimal = new BigDecimal("7.5");
        System.out.println(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP));

        List<User> arrl=new ArrayList<>();
        arrl.add(new User("1","张三"));
        arrl.add(new User("3","李四"));
        arrl.add(new User("5","刘七"));
        arrl.add(new User("4","朱六"));
        arrl.add(new User("2","王五"));


        arrl.sort(Comparator.comparing(User::getId).reversed());

        System.out.println(JSONObject.toJSON(arrl));

        LocalDate begain=LocalDate.of(2022,4,11);
        LocalDate end=LocalDate.of(2099,3,1);
        LocalDate now1 = LocalDate.now();
        System.out.println(now1.isAfter(begain));
        System.out.println(now1.isEqual(begain));
        System.out.println(now1.isBefore(end));


        LocalDate begain123=LocalDate.of(2022,3,11);
        System.out.println(begain123.isBefore(now1));
    }
}
